package com.carkepper.appraisal.controller;

import com.carkepper.appraisal.pojo.Appraisal;
import com.carkepper.appraisal.service.AppraisalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 服务评价表的controller层
 */
@RestController
@RequestMapping("/appraisal")
public class AppraisalController {

    @Autowired
    private AppraisalService appraisalService;

    /**
     * 查询全部信息
     * @return
     */
    @GetMapping("/findAll")
    public List<Appraisal> findALl(){
        List<Appraisal> appraisalList = appraisalService.findAll();
        return appraisalList;
    }


    /**
     * 增加一条信息
     * @return
     */
    @PostMapping("add")
    public String add(@RequestBody Appraisal appraisal){
//        System.out.println("controller得到的数据：" + appraisal);
        appraisalService.add(appraisal);
        return "添加成功";
    }


}
